var page=1;
var pageSize=10;
var table,layer;
var userList={};
var sharedFileId = "";
var sharedFileCreatePeople = "";
//获取父页面的传值
function child(id) {
    //查询共享组详情
    let sharedFile={};
    sharedFile.id=id;
    sharedFile.userId=sessionStorage.getItem("id");
    $.ajax({
        url: sessionStorage.getItem("rootPath") + "/sharedFiles/selectSharedFileUser",
        method: "post",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        data: JSON.stringify(sharedFile),
        success: function (res) {
            sharedFileId = res.sharedFile.id;
            sharedFileCreatePeople = res.sharedFile.createPeople;
            userList = res.userList;
            $("#sharedfileName").val(res.sharedFile.sharedfileName);
            renderTable(userList);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log("失败" + XMLHttpRequest.status + ":" + textStatus + ":" + errorThrown);
        }
    })
}

$(function () {
    //获取表格数据
    getUserList();
    layui.use(['form'], function() {
        var form = layui.form;
        layer=layui.layer;
        form.on('submit(sharedFiles-save)', function(data){
            submit();
        });

    })

})

/**
 * 表格渲染
 */
function renderTable(data) {
    layui.use('table', function () {
        table = layui.table;
        table.render({
            elem: '#usersTable'
            ,url: '../../admin/data/common.json'
            , page: false
            , height: 400
            ,defaultToolbar: ['exports', 'print']
            , parseData: function (res) {
                return {
                    "code": 0,
                    "msg": "",
                    "data": data
                }
            }
            , cols: [[
                {field: 'userId', title: '账号', sort: true}
                , {field: 'userName', title: '真实姓名'}
                , {field: 'roleName', title: '角色', sort: true}
                , {field: 'email', title: '邮箱'}
                , {field: 'phoneNum', title: '电话'}
            ]]
        });

    });
}


